package com.hailiang.saas.auth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * Author: shentao
 * Auto-Generated
 */
@SpringBootApplication(scanBasePackages = {"com.hailiang.saas.*", "com.hailiang.mp.commonsource.*"})
@EnableDiscoveryClient
@EnableFeignClients(basePackages = "com.hailiang.*")
@EnableScheduling
@ImportResource({"classpath*:META-INF/spring/*.xml" })
@EnableAsync
public class SaasAuthApplication {

    public static void main(String[] args) {
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(31);
        System.out.println(bCryptPasswordEncoder.encode("A123456"));
        SpringApplication.run(SaasAuthApplication.class, args);
    }

    @Bean({ "threadPoolTaskExecutor" })
    public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(8);
        executor.setMaxPoolSize(32);
        executor.setQueueCapacity(2048);
        return executor;
    }

}
